package com.countertack.hadoop;

import java.net.URI;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;


/**
* @author karan
*
*/
public class HDFSFileDownload {


public static void main(String[] args) throws Exception {

    Configuration conf = new Configuration();

    conf.addResource(new Path("src/com/hcl/hadoop/core-site.xml"));
    conf.addResource(new Path("src/com/hcl/hadoop/hdfs-site.xml"));



    String dirName = "hdfs://10.150.100.243/extracted_files";

    //values of hosthdfs:port can be found in the core-site.xml  in the fs.default.name

    FileSystem fileSystem = FileSystem.get(conf);


    Path path = new Path(dirName);
    if (fileSystem.exists(path)) {
        System.out.println("Dir " + dirName + " already exists");
        return;
    }

    // Create directories
   // fileSystem.mkdirs(path);

    fileSystem.close();
}
}